package com.icongyou.enterprise.talent_profile.entity.vo;

import lombok.Data;
import java.time.LocalDateTime;

/**
 * 单个提交详情VO
 */
@Data
public class SubmissionDetailVO {
    // 提交信息
    private String submissionId;
    private String teamId;
    private String contentUrl;
    private Double contributionRate;
    private LocalDateTime submissionTime;
    private String status;
    private Integer actualDuration;
    private Boolean isLate;
    private Integer likeCount;
    private Integer favoriteCount;

    // 批改信息
    private String gradeId;
    private Double score;
    private Double aiScore;
    private Double finalScore;
    private String textComment;
    private String aiTextComment;
    private String voiceCommentUrl;
    private Boolean isTeacherRecommended;
    private LocalDateTime gradingTime;

    // 任务信息
    private String assignmentId;
    private String assignmentName;
    private String assignmentDescription;
    private Integer assignmentType; // 0：个人、1：团队
    private Double fullScore;
    private String gradingCriteria;
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private Integer expectedDuration;

    // 课程信息
    private String courseId;
    private String courseName;
    private String courseIntro;
    private String academicYear;

    // 教师信息
    private String teacherId;
    private String teacherName;
    private String teacherDepartment;

    // 学生信息
    private String studentId;
    private String studentName;
    private String studentAvatar;

    // 计算字段
    private Double scoreRatio;
    private String assignmentTypeDesc;
    private String durationComparison;

    /**
     * 计算得分比例
     */
    public Double getScoreRatio() {
        if (fullScore != null && fullScore > 0 && finalScore != null) {
            return Math.round((finalScore / fullScore) * 100 * 100.0) / 100.0;
        }
        return 0.0;
    }

    /**
     * 获取任务类型描述
     */
    public String getAssignmentTypeDesc() {
        if (assignmentType == null) return "未知";
        return assignmentType == 0 ? "个人任务" : "团队任务";
    }

    /**
     * 获取时长比较信息
     */
    public String getDurationComparison() {
        if (expectedDuration != null && actualDuration != null) {
            if (actualDuration <= expectedDuration) {
                return "提前完成";
            } else {
                int diff = actualDuration - expectedDuration;
                return "超时" + diff + "分钟";
            }
        }
        return "";
    }
}